package objects;

/**
 * 园
 * @author: yyfei  
 * @email:  yyfei123@qq.com
 */
public class Circle {
	private double PI=Math.PI;
	private double r;
	public Circle(double r) {
		if(r<=0) {
			System.out.println("圆的半径不能为负数");
			return;
		}
		this.r=r;
	}
	public double getR() {
		return r;
	}

	public void setR(double r) {
		if(r<=0) {
			System.out.println("圆的半径不能为负数");
		}else {
			this.r = r;	
		}
	}
	
	public double area() {
		double area;
		area=PI*r*r;
		return area;
	}
}
